diff options
Diffstat (limited to 'www/src/pages/blog/[slug].astro')
-rw-r--r-- | www/src/pages/blog/[slug].astro | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/www/src/pages/blog/[slug].astro b/www/src/pages/blog/[slug].astro deleted file mode 100644 index 93260f90e..000000000 --- a/www/src/pages/blog/[slug].astro +++ /dev/null @@ -1,46 +0,0 @@ ---- -import BaseHead from '../../components/BaseHead.astro'; -import BlogHeader from '../../components/BlogHeader.astro'; -import BlogPost from '../../components/BlogPost.astro'; -import GoogleAnalytics from '../../components/GoogleAnalytics.astro'; - -export function getPostSlug(post) { - return post.file.pathname.split('/').pop().split('.').shift(); -} - -export function getStaticPaths({rss}) { - const posts = Astro.fetchContent('../../data/blog-posts/*.md').sort((a, b) => new Date(b.publishDate) - new Date(a.publishDate)); - - rss({ - title: 'Astro Blog', - description: 'Everything you need to know about Astro, direct from mission control.', - items: posts.map(p => ({ - title: p.title, - description: p.description, - link: `blog/${getPostSlug(p)}`, - pubDate: p.publishDate, - })) - }); - - return posts.map((p) => ({ - params: { slug: getPostSlug(p) }, - props: { post: p }, - })); -} - -const { Content, title, author, description, publishDate, heroImage, heroImageAlt, socialImage, permalink, lang } = Astro.props.post; ---- - -<html lang={lang ?? 'en'}> - <head> - <BaseHead {title} {description} canonicalURL={permalink} image={socialImage && `https://astro.build${socialImage}`} /> - <link rel="stylesheet" href={Astro.resolve('../../scss/blog.scss')} /> - </head> - <body> - <BlogHeader /> - <BlogPost {title} {author} {publishDate} {heroImage} {heroImageAlt}> - <Content /> - </BlogPost> - <GoogleAnalytics /> - </body> -</html> |